<template>
  <div class="search">
    <div class="left">
      <div class="item">
        <div class="name">住</div>
        <div class="time">{{ startDate ? startDateStr : '2月11日' }}</div>
      </div>
      <div class="end item">
        <div class="name">离</div>
        <div class="time">{{ endDate ? endDateStr : '2月12日' }}</div>
      </div>
    </div>
    <div class="right">
      <div class="l1">关键字/位置/民宿</div>
      <div class="r1">
        <div class="icon"></div>
      </div>
    </div>
  </div>
</template>
<script setup>
import { useTime } from '../../Pinia/modules/time';
import { toRefs, computed } from 'vue'
import { storeToRefs } from 'pinia'
import { formerTime } from '../../utils/dataFormal';
const timer = useTime()
const { startDate,
  endDate } = toRefs(timer.$state)
const startDateStr = computed(() => formerTime(startDate.value, "MM.DD"))
const endDateStr = computed(() => formerTime(endDate.value, "MM.DD"));
// console.log(endDateStr);
</script>
<style scoped>
.search {
  display: flex;
  flex-direction: row;
  align-items: center;
  height: 45px;
  line-height: 45px;
  padding: 0 10px;
  font-size: 14px;
  color: #999;
  border-radius: 6px;
  background: #f2f4f6;
}

.left {
  display: flex;
  flex-direction: column;
  border-right: 1px solid white;
}

.item {
  display: flex;
  flex-direction: row;
  align-items: center;
  line-height: normal;
  font-size: 12px;
}

.end ::after {
  content: "";
  width: 0;
  height: 0;
  border: 4px solid #666;
  border-color: rgba(0, 0, 0, 0) rgba(0, 0, 0, 0) rgba(0, 0, 0, 0) #666;
  -webkit-border-radius: 3px;
  border-radius: 3px;
  -webkit-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  transform: rotate(45deg);
  position: absolute;
  bottom: 0px;
  right: -12px;
}

.time {
  position: relative;
  color: #333;
  margin: 0 10px 0 3px;
  font-weight: 500;
}

.right {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 0 6px;
  flex: 1;
}

.r1 {
  width: 24px;
  height: 24px;
  display: inline-block;
  background-image: url(/src/assets/img/home/home-sprite.png);
  background-position: -29px -151px;
  background-size: 207px 192px;
}
</style>